clear			all
set 			more off
cd 				"~/Dropbox/Indonesia Migration/" // Specify your root directory here
/*******************************************************************************
					EDUCATION HETEROGENEITY
*******************************************************************************/	
use				"Data/Merged", clear
bys				year: egen mean_av_high_educ = mean(av_high_educ)
bys				year: gen high_educ_regency = av_high_educ >= mean_av_high_educ
foreach 		var in emp native_emp mig_emp_o mig_emp_n ///
				wage native_wage mig_wage_o mig_wage_n ///
				SE native_SE mig_SE_o mig_SE_n ///
				unpaid native_unpaid mig_unpaid_o mig_unpaid_n {
replace			prop_`var' = prop_`var' * 100
}
label 			var per_immig_cst_5Y "Population share of new migrants in year t"
label 			var per_immig_cst_5Y_lag "Population share of new migrants in year t-5"


/*******************************************************************************
					Employment	
********************************************************************************/
ivreg2			prop_emp (per_immig_cst_5Y per_immig_cst_5Y_lag = ///
				pred_per_immig_cst_10Y_5Y pred_per_immig_cst_Jaeger_10Y) ///
				i.year#i.geolev1 i.geolev2 av_high_educ_ct prop_male_ct av_age_ct ///
				if high_educ_regency == 1, cl(geolev1) first	
mat				c = e(first)
local			SWF1= c[8,1]
local			SWF2= c[8,2]
su				`e(depvar)' if e(sample) == 1, d				
local			meandv=r(mean)
outreg2			using "Tables/Education heterogeneity.xlsx", excel tex replace dec(4) ///
				keep(per_immig_cst_5Y per_immig_cst_5Y_lag) label nocons nonotes ///
				addtext("Sanderson-Windmeijer F-Stat 1", `: di %9.2f `SWF1'', ///
				"Sanderson-Windmeijer F-Stat 2", `: di %9.2f `SWF2'', ///
				"Kleibergen-Paap rk LM statistic", `: di %9.2f `e(idstat)'', ///
				"p-value", "[`: di %9.2f `e(idp)'']", "District education level", High, ///
				"Mean of DV", `: di %9.2f `meandv'', "# of provinces", ///
				`e(N_clust)', "District FE", YES, "Province-year FE", YES)

ivreg2			prop_emp (per_immig_cst_5Y per_immig_cst_5Y_lag = ///
				pred_per_immig_cst_10Y_5Y pred_per_immig_cst_Jaeger_10Y) ///
				i.year#i.geolev1 i.geolev2 av_high_educ_ct prop_male_ct av_age_ct ///
				if high_educ_regency == 0, cl(geolev1) first	
mat				c = e(first)
local			SWF1= c[8,1]
local			SWF2= c[8,2]
su				`e(depvar)' if e(sample) == 1, d				
local			meandv=r(mean)
outreg2			using "Tables/Education heterogeneity.xlsx", excel tex append dec(4) ///
				keep(per_immig_cst_5Y per_immig_cst_5Y_lag) label nocons nonotes ///
				addtext("Sanderson-Windmeijer F-Stat 1", `: di %9.2f `SWF1'', ///
				"Sanderson-Windmeijer F-Stat 2", `: di %9.2f `SWF2'', ///
				"Kleibergen-Paap rk LM statistic", `: di %9.2f `e(idstat)'', ///
				"p-value", "[`: di %9.2f `e(idp)'']", "District education level", Low, ///
				"Mean of DV", `: di %9.2f `meandv'', "# of provinces", ///
				`e(N_clust)', "District FE", YES, "Province-year FE", YES)
				
				
				
ivreg2			prop_native_emp (per_immig_cst_5Y per_immig_cst_5Y_lag = ///
				pred_per_immig_cst_10Y_5Y pred_per_immig_cst_Jaeger_10Y) ///
				i.year#i.geolev1 i.geolev2 av_high_educ_ct prop_male_ct av_age_ct ///
				if high_educ_regency == 1, cl(geolev1) first	
mat				c = e(first)
local			SWF1= c[8,1]
local			SWF2= c[8,2]
su				`e(depvar)' if e(sample) == 1, d				
local			meandv=r(mean)
outreg2			using "Tables/Education heterogeneity.xlsx", excel tex append dec(4) ///
				keep(per_immig_cst_5Y per_immig_cst_5Y_lag) label nocons nonotes ///
				addtext("Sanderson-Windmeijer F-Stat 1", `: di %9.2f `SWF1'', ///
				"Sanderson-Windmeijer F-Stat 2", `: di %9.2f `SWF2'', ///
				"Kleibergen-Paap rk LM statistic", `: di %9.2f `e(idstat)'', ///
				"p-value", "[`: di %9.2f `e(idp)'']", "District education level", High, ///
				"Mean of DV", `: di %9.2f `meandv'', "# of provinces", ///
				`e(N_clust)', "District FE", YES, "Province-year FE", YES)

ivreg2			prop_native_emp (per_immig_cst_5Y per_immig_cst_5Y_lag = ///
				pred_per_immig_cst_10Y_5Y pred_per_immig_cst_Jaeger_10Y) ///
				i.year#i.geolev1 i.geolev2 av_high_educ_ct prop_male_ct av_age_ct ///
				if high_educ_regency == 0, cl(geolev1) first	
mat				c = e(first)
local			SWF1= c[8,1]
local			SWF2= c[8,2]
su				`e(depvar)' if e(sample) == 1, d				
local			meandv=r(mean)
outreg2			using "Tables/Education heterogeneity.xlsx", excel tex append dec(4) ///
				keep(per_immig_cst_5Y per_immig_cst_5Y_lag) label nocons nonotes ///
				addtext("Sanderson-Windmeijer F-Stat 1", `: di %9.2f `SWF1'', ///
				"Sanderson-Windmeijer F-Stat 2", `: di %9.2f `SWF2'', ///
				"Kleibergen-Paap rk LM statistic", `: di %9.2f `e(idstat)'', ///
				"p-value", "[`: di %9.2f `e(idp)'']", "District education level", Low, ///
				"Mean of DV", `: di %9.2f `meandv'', "# of provinces", ///
				`e(N_clust)', "District FE", YES, "Province-year FE", YES)
				
				
ivreg2			prop_mig_emp_o (per_immig_cst_5Y per_immig_cst_5Y_lag = ///
				pred_per_immig_cst_10Y_5Y pred_per_immig_cst_Jaeger_10Y) ///
				i.year#i.geolev1 i.geolev2 av_high_educ_ct prop_male_ct av_age_ct ///
				if high_educ_regency == 1, cl(geolev1) first	
mat				c = e(first)
local			SWF1= c[8,1]
local			SWF2= c[8,2]
su				`e(depvar)' if e(sample) == 1, d				
local			meandv=r(mean)
outreg2			using "Tables/Education heterogeneity.xlsx", excel tex append dec(4) ///
				keep(per_immig_cst_5Y per_immig_cst_5Y_lag) label nocons nonotes ///
				addtext("Sanderson-Windmeijer F-Stat 1", `: di %9.2f `SWF1'', ///
				"Sanderson-Windmeijer F-Stat 2", `: di %9.2f `SWF2'', ///
				"Kleibergen-Paap rk LM statistic", `: di %9.2f `e(idstat)'', ///
				"p-value", "[`: di %9.2f `e(idp)'']", "District education level", High, ///
				"Mean of DV", `: di %9.2f `meandv'', "# of provinces", ///
				`e(N_clust)', "District FE", YES, "Province-year FE", YES)
				
ivreg2			prop_mig_emp_o (per_immig_cst_5Y per_immig_cst_5Y_lag = ///
				pred_per_immig_cst_10Y_5Y pred_per_immig_cst_Jaeger_10Y) ///
				i.year#i.geolev1 i.geolev2 av_high_educ_ct prop_male_ct av_age_ct ///
				if high_educ_regency == 0, cl(geolev1) first	
mat				c = e(first)
local			SWF1= c[8,1]
local			SWF2= c[8,2]
su				`e(depvar)' if e(sample) == 1, d				
local			meandv=r(mean)
outreg2			using "Tables/Education heterogeneity.xlsx", excel tex append dec(4) ///
				keep(per_immig_cst_5Y per_immig_cst_5Y_lag) label nocons nonotes ///
				addtext("Sanderson-Windmeijer F-Stat 1", `: di %9.2f `SWF1'', ///
				"Sanderson-Windmeijer F-Stat 2", `: di %9.2f `SWF2'', ///
				"Kleibergen-Paap rk LM statistic", `: di %9.2f `e(idstat)'', ///
				"p-value", "[`: di %9.2f `e(idp)'']", "District education level", Low, ///
				"Mean of DV", `: di %9.2f `meandv'', "# of provinces", ///
				`e(N_clust)', "District FE", YES, "Province-year FE", YES)
				
ivreg2			prop_mig_emp_n (per_immig_cst_5Y per_immig_cst_5Y_lag = ///
				pred_per_immig_cst_10Y_5Y pred_per_immig_cst_Jaeger_10Y) ///
				i.year#i.geolev1 i.geolev2 av_high_educ_ct prop_male_ct av_age_ct ///
				if high_educ_regency == 1, cl(geolev1) first	
mat				c = e(first)
local			SWF1= c[8,1]
local			SWF2= c[8,2]
su				`e(depvar)' if e(sample) == 1, d				
local			meandv=r(mean)
outreg2			using "Tables/Education heterogeneity.xlsx", excel tex append dec(4) ///
				keep(per_immig_cst_5Y per_immig_cst_5Y_lag) label nocons nonotes ///
				addtext("Sanderson-Windmeijer F-Stat 1", `: di %9.2f `SWF1'', ///
				"Sanderson-Windmeijer F-Stat 2", `: di %9.2f `SWF2'', ///
				"Kleibergen-Paap rk LM statistic", `: di %9.2f `e(idstat)'', ///
				"p-value", "[`: di %9.2f `e(idp)'']", "District education level", High, ///
				"Mean of DV", `: di %9.2f `meandv'', "# of provinces", ///
				`e(N_clust)', "District FE", YES, "Province-year FE", YES)
				
ivreg2			prop_mig_emp_n (per_immig_cst_5Y per_immig_cst_5Y_lag = ///
				pred_per_immig_cst_10Y_5Y pred_per_immig_cst_Jaeger_10Y) ///
				i.year#i.geolev1 i.geolev2 av_high_educ_ct prop_male_ct av_age_ct ///
				if high_educ_regency == 0, cl(geolev1) first	
mat				c = e(first)
local			SWF1= c[8,1]
local			SWF2= c[8,2]
su				`e(depvar)' if e(sample) == 1, d				
local			meandv=r(mean)
outreg2			using "Tables/Education heterogeneity.xlsx", excel tex append dec(4) ///
				keep(per_immig_cst_5Y per_immig_cst_5Y_lag) label nocons nonotes ///
				addtext("Sanderson-Windmeijer F-Stat 1", `: di %9.2f `SWF1'', ///
				"Sanderson-Windmeijer F-Stat 2", `: di %9.2f `SWF2'', ///
				"Kleibergen-Paap rk LM statistic", `: di %9.2f `e(idstat)'', ///
				"p-value", "[`: di %9.2f `e(idp)'']", "District education level", Low, ///
				"Mean of DV", `: di %9.2f `meandv'', "# of provinces", ///
				`e(N_clust)', "District FE", YES, "Province-year FE", YES)				
							
/*******************************************************************************
					Wage employment
********************************************************************************/				
ivreg2			prop_wage (per_immig_cst_5Y per_immig_cst_5Y_lag = ///
				pred_per_immig_cst_10Y_5Y pred_per_immig_cst_Jaeger_10Y) ///
				i.year#i.geolev1 i.geolev2 av_high_educ_ct prop_male_ct av_age_ct ///
				if high_educ_regency == 1, cl(geolev1) first	
mat				c = e(first)
local			SWF1= c[8,1]
local			SWF2= c[8,2]
su				`e(depvar)' if e(sample) == 1, d				
local			meandv=r(mean)
outreg2			using "Tables/Education heterogeneity 2.xlsx", excel tex replace dec(4) ///
				keep(per_immig_cst_5Y per_immig_cst_5Y_lag) label nocons nonotes ///
				addtext("Sanderson-Windmeijer F-Stat 1", `: di %9.2f `SWF1'', ///
				"Sanderson-Windmeijer F-Stat 2", `: di %9.2f `SWF2'', ///
				"Kleibergen-Paap rk LM statistic", `: di %9.2f `e(idstat)'', ///
				"p-value", "[`: di %9.2f `e(idp)'']", "District education level", High, ///
				"Mean of DV", `: di %9.2f `meandv'', "# of provinces", ///
				`e(N_clust)', "District FE", YES, "Province-year FE", YES)

ivreg2			prop_wage (per_immig_cst_5Y per_immig_cst_5Y_lag = ///
				pred_per_immig_cst_10Y_5Y pred_per_immig_cst_Jaeger_10Y) ///
				i.year#i.geolev1 i.geolev2 av_high_educ_ct prop_male_ct av_age_ct ///
				if high_educ_regency == 0, cl(geolev1) first	
mat				c = e(first)
local			SWF1= c[8,1]
local			SWF2= c[8,2]
su				`e(depvar)' if e(sample) == 1, d				
local			meandv=r(mean)
outreg2			using "Tables/Education heterogeneity 2.xlsx", excel tex append dec(4) ///
				keep(per_immig_cst_5Y per_immig_cst_5Y_lag) label nocons nonotes ///
				addtext("Sanderson-Windmeijer F-Stat 1", `: di %9.2f `SWF1'', ///
				"Sanderson-Windmeijer F-Stat 2", `: di %9.2f `SWF2'', ///
				"Kleibergen-Paap rk LM statistic", `: di %9.2f `e(idstat)'', ///
				"p-value", "[`: di %9.2f `e(idp)'']", "District education level", Low, ///
				"Mean of DV", `: di %9.2f `meandv'', "# of provinces", ///
				`e(N_clust)', "District FE", YES, "Province-year FE", YES)
				
				
				
ivreg2			prop_native_wage (per_immig_cst_5Y per_immig_cst_5Y_lag = ///
				pred_per_immig_cst_10Y_5Y pred_per_immig_cst_Jaeger_10Y) ///
				i.year#i.geolev1 i.geolev2 av_high_educ_ct prop_male_ct av_age_ct ///
				if high_educ_regency == 1, cl(geolev1) first	
mat				c = e(first)
local			SWF1= c[8,1]
local			SWF2= c[8,2]
su				`e(depvar)' if e(sample) == 1, d				
local			meandv=r(mean)
outreg2			using "Tables/Education heterogeneity 2.xlsx", excel tex append dec(4) ///
				keep(per_immig_cst_5Y per_immig_cst_5Y_lag) label nocons nonotes ///
				addtext("Sanderson-Windmeijer F-Stat 1", `: di %9.2f `SWF1'', ///
				"Sanderson-Windmeijer F-Stat 2", `: di %9.2f `SWF2'', ///
				"Kleibergen-Paap rk LM statistic", `: di %9.2f `e(idstat)'', ///
				"p-value", "[`: di %9.2f `e(idp)'']", "District education level", High, ///
				"Mean of DV", `: di %9.2f `meandv'', "# of provinces", ///
				`e(N_clust)', "District FE", YES, "Province-year FE", YES)

ivreg2			prop_native_wage (per_immig_cst_5Y per_immig_cst_5Y_lag = ///
				pred_per_immig_cst_10Y_5Y pred_per_immig_cst_Jaeger_10Y) ///
				i.year#i.geolev1 i.geolev2 av_high_educ_ct prop_male_ct av_age_ct ///
				if high_educ_regency == 0, cl(geolev1) first	
mat				c = e(first)
local			SWF1= c[8,1]
local			SWF2= c[8,2]
su				`e(depvar)' if e(sample) == 1, d				
local			meandv=r(mean)
outreg2			using "Tables/Education heterogeneity 2.xlsx", excel tex append dec(4) ///
				keep(per_immig_cst_5Y per_immig_cst_5Y_lag) label nocons nonotes ///
				addtext("Sanderson-Windmeijer F-Stat 1", `: di %9.2f `SWF1'', ///
				"Sanderson-Windmeijer F-Stat 2", `: di %9.2f `SWF2'', ///
				"Kleibergen-Paap rk LM statistic", `: di %9.2f `e(idstat)'', ///
				"p-value", "[`: di %9.2f `e(idp)'']", "District education level", Low, ///
				"Mean of DV", `: di %9.2f `meandv'', "# of provinces", ///
				`e(N_clust)', "District FE", YES, "Province-year FE", YES)
				
				
ivreg2			prop_mig_wage_o (per_immig_cst_5Y per_immig_cst_5Y_lag = ///
				pred_per_immig_cst_10Y_5Y pred_per_immig_cst_Jaeger_10Y) ///
				i.year#i.geolev1 i.geolev2 av_high_educ_ct prop_male_ct av_age_ct ///
				if high_educ_regency == 1, cl(geolev1) first	
mat				c = e(first)
local			SWF1= c[8,1]
local			SWF2= c[8,2]
su				`e(depvar)' if e(sample) == 1, d				
local			meandv=r(mean)
outreg2			using "Tables/Education heterogeneity 2.xlsx", excel tex append dec(4) ///
				keep(per_immig_cst_5Y per_immig_cst_5Y_lag) label nocons nonotes ///
				addtext("Sanderson-Windmeijer F-Stat 1", `: di %9.2f `SWF1'', ///
				"Sanderson-Windmeijer F-Stat 2", `: di %9.2f `SWF2'', ///
				"Kleibergen-Paap rk LM statistic", `: di %9.2f `e(idstat)'', ///
				"p-value", "[`: di %9.2f `e(idp)'']", "District education level", High, ///
				"Mean of DV", `: di %9.2f `meandv'', "# of provinces", ///
				`e(N_clust)', "District FE", YES, "Province-year FE", YES)
				
ivreg2			prop_mig_wage_o (per_immig_cst_5Y per_immig_cst_5Y_lag = ///
				pred_per_immig_cst_10Y_5Y pred_per_immig_cst_Jaeger_10Y) ///
				i.year#i.geolev1 i.geolev2 av_high_educ_ct prop_male_ct av_age_ct ///
				if high_educ_regency == 0, cl(geolev1) first	
mat				c = e(first)
local			SWF1= c[8,1]
local			SWF2= c[8,2]
su				`e(depvar)' if e(sample) == 1, d				
local			meandv=r(mean)
outreg2			using "Tables/Education heterogeneity 2.xlsx", excel tex append dec(4) ///
				keep(per_immig_cst_5Y per_immig_cst_5Y_lag) label nocons nonotes ///
				addtext("Sanderson-Windmeijer F-Stat 1", `: di %9.2f `SWF1'', ///
				"Sanderson-Windmeijer F-Stat 2", `: di %9.2f `SWF2'', ///
				"Kleibergen-Paap rk LM statistic", `: di %9.2f `e(idstat)'', ///
				"p-value", "[`: di %9.2f `e(idp)'']", "District education level", Low, ///
				"Mean of DV", `: di %9.2f `meandv'', "# of provinces", ///
				`e(N_clust)', "District FE", YES, "Province-year FE", YES)
				
ivreg2			prop_mig_wage_n (per_immig_cst_5Y per_immig_cst_5Y_lag = ///
				pred_per_immig_cst_10Y_5Y pred_per_immig_cst_Jaeger_10Y) ///
				i.year#i.geolev1 i.geolev2 av_high_educ_ct prop_male_ct av_age_ct ///
				if high_educ_regency == 1, cl(geolev1) first	
mat				c = e(first)
local			SWF1= c[8,1]
local			SWF2= c[8,2]
su				`e(depvar)' if e(sample) == 1, d				
local			meandv=r(mean)
outreg2			using "Tables/Education heterogeneity 2.xlsx", excel tex append dec(4) ///
				keep(per_immig_cst_5Y per_immig_cst_5Y_lag) label nocons nonotes ///
				addtext("Sanderson-Windmeijer F-Stat 1", `: di %9.2f `SWF1'', ///
				"Sanderson-Windmeijer F-Stat 2", `: di %9.2f `SWF2'', ///
				"Kleibergen-Paap rk LM statistic", `: di %9.2f `e(idstat)'', ///
				"p-value", "[`: di %9.2f `e(idp)'']", "District education level", High, ///
				"Mean of DV", `: di %9.2f `meandv'', "# of provinces", ///
				`e(N_clust)', "District FE", YES, "Province-year FE", YES)
				
ivreg2			prop_mig_wage_n (per_immig_cst_5Y per_immig_cst_5Y_lag = ///
				pred_per_immig_cst_10Y_5Y pred_per_immig_cst_Jaeger_10Y) ///
				i.year#i.geolev1 i.geolev2 av_high_educ_ct prop_male_ct av_age_ct ///
				if high_educ_regency == 0, cl(geolev1) first	
mat				c = e(first)
local			SWF1= c[8,1]
local			SWF2= c[8,2]
su				`e(depvar)' if e(sample) == 1, d				
local			meandv=r(mean)
outreg2			using "Tables/Education heterogeneity 2.xlsx", excel tex append dec(4) ///
				keep(per_immig_cst_5Y per_immig_cst_5Y_lag) label nocons nonotes ///
				addtext("Sanderson-Windmeijer F-Stat 1", `: di %9.2f `SWF1'', ///
				"Sanderson-Windmeijer F-Stat 2", `: di %9.2f `SWF2'', ///
				"Kleibergen-Paap rk LM statistic", `: di %9.2f `e(idstat)'', ///
				"p-value", "[`: di %9.2f `e(idp)'']", "District education level", Low, ///
				"Mean of DV", `: di %9.2f `meandv'', "# of provinces", ///
				`e(N_clust)', "District FE", YES, "Province-year FE", YES)						
				
				
				
				
							
/*******************************************************************************
					Self employment
********************************************************************************/				
ivreg2			prop_SE (per_immig_cst_5Y per_immig_cst_5Y_lag = ///
				pred_per_immig_cst_10Y_5Y pred_per_immig_cst_Jaeger_10Y) ///
				i.year#i.geolev1 i.geolev2 av_high_educ_ct prop_male_ct av_age_ct ///
				if high_educ_regency == 1, cl(geolev1) first	
mat				c = e(first)
local			SWF1= c[8,1]
local			SWF2= c[8,2]
su				`e(depvar)' if e(sample) == 1, d				
local			meandv=r(mean)
outreg2			using "Tables/Education heterogeneity 3.xlsx", excel tex replace dec(4) ///
				keep(per_immig_cst_5Y per_immig_cst_5Y_lag) label nocons nonotes ///
				addtext("Sanderson-Windmeijer F-Stat 1", `: di %9.2f `SWF1'', ///
				"Sanderson-Windmeijer F-Stat 2", `: di %9.2f `SWF2'', ///
				"Kleibergen-Paap rk LM statistic", `: di %9.2f `e(idstat)'', ///
				"p-value", "[`: di %9.2f `e(idp)'']", "District education level", High, ///
				"Mean of DV", `: di %9.2f `meandv'', "# of provinces", ///
				`e(N_clust)', "District FE", YES, "Province-year FE", YES)

ivreg2			prop_SE (per_immig_cst_5Y per_immig_cst_5Y_lag = ///
				pred_per_immig_cst_10Y_5Y pred_per_immig_cst_Jaeger_10Y) ///
				i.year#i.geolev1 i.geolev2 av_high_educ_ct prop_male_ct av_age_ct ///
				if high_educ_regency == 0, cl(geolev1) first	
mat				c = e(first)
local			SWF1= c[8,1]
local			SWF2= c[8,2]
su				`e(depvar)' if e(sample) == 1, d				
local			meandv=r(mean)
outreg2			using "Tables/Education heterogeneity 3.xlsx", excel tex append dec(4) ///
				keep(per_immig_cst_5Y per_immig_cst_5Y_lag) label nocons nonotes ///
				addtext("Sanderson-Windmeijer F-Stat 1", `: di %9.2f `SWF1'', ///
				"Sanderson-Windmeijer F-Stat 2", `: di %9.2f `SWF2'', ///
				"Kleibergen-Paap rk LM statistic", `: di %9.2f `e(idstat)'', ///
				"p-value", "[`: di %9.2f `e(idp)'']", "District education level", Low, ///
				"Mean of DV", `: di %9.2f `meandv'', "# of provinces", ///
				`e(N_clust)', "District FE", YES, "Province-year FE", YES)
				
				
ivreg2			prop_native_SE (per_immig_cst_5Y per_immig_cst_5Y_lag = ///
				pred_per_immig_cst_10Y_5Y pred_per_immig_cst_Jaeger_10Y) ///
				i.year#i.geolev1 i.geolev2 av_high_educ_ct prop_male_ct av_age_ct ///
				if high_educ_regency == 1, cl(geolev1) first	
mat				c = e(first)
local			SWF1= c[8,1]
local			SWF2= c[8,2]
su				`e(depvar)' if e(sample) == 1, d				
local			meandv=r(mean)
outreg2			using "Tables/Education heterogeneity 3.xlsx", excel tex append dec(4) ///
				keep(per_immig_cst_5Y per_immig_cst_5Y_lag) label nocons nonotes ///
				addtext("Sanderson-Windmeijer F-Stat 1", `: di %9.2f `SWF1'', ///
				"Sanderson-Windmeijer F-Stat 2", `: di %9.2f `SWF2'', ///
				"Kleibergen-Paap rk LM statistic", `: di %9.2f `e(idstat)'', ///
				"p-value", "[`: di %9.2f `e(idp)'']", "District education level", High, ///
				"Mean of DV", `: di %9.2f `meandv'', "# of provinces", ///
				`e(N_clust)', "District FE", YES, "Province-year FE", YES)

ivreg2			prop_native_SE (per_immig_cst_5Y per_immig_cst_5Y_lag = ///
				pred_per_immig_cst_10Y_5Y pred_per_immig_cst_Jaeger_10Y) ///
				i.year#i.geolev1 i.geolev2 av_high_educ_ct prop_male_ct av_age_ct ///
				if high_educ_regency == 0, cl(geolev1) first	
mat				c = e(first)
local			SWF1= c[8,1]
local			SWF2= c[8,2]
su				`e(depvar)' if e(sample) == 1, d				
local			meandv=r(mean)
outreg2			using "Tables/Education heterogeneity 3.xlsx", excel tex append dec(4) ///
				keep(per_immig_cst_5Y per_immig_cst_5Y_lag) label nocons nonotes ///
				addtext("Sanderson-Windmeijer F-Stat 1", `: di %9.2f `SWF1'', ///
				"Sanderson-Windmeijer F-Stat 2", `: di %9.2f `SWF2'', ///
				"Kleibergen-Paap rk LM statistic", `: di %9.2f `e(idstat)'', ///
				"p-value", "[`: di %9.2f `e(idp)'']", "District education level", Low, ///
				"Mean of DV", `: di %9.2f `meandv'', "# of provinces", ///
				`e(N_clust)', "District FE", YES, "Province-year FE", YES)
				
				
ivreg2			prop_mig_SE_o (per_immig_cst_5Y per_immig_cst_5Y_lag = ///
				pred_per_immig_cst_10Y_5Y pred_per_immig_cst_Jaeger_10Y) ///
				i.year#i.geolev1 i.geolev2 av_high_educ_ct prop_male_ct av_age_ct ///
				if high_educ_regency == 1, cl(geolev1) first	
mat				c = e(first)
local			SWF1= c[8,1]
local			SWF2= c[8,2]
su				`e(depvar)' if e(sample) == 1, d				
local			meandv=r(mean)
outreg2			using "Tables/Education heterogeneity 3.xlsx", excel tex append dec(4) ///
				keep(per_immig_cst_5Y per_immig_cst_5Y_lag) label nocons nonotes ///
				addtext("Sanderson-Windmeijer F-Stat 1", `: di %9.2f `SWF1'', ///
				"Sanderson-Windmeijer F-Stat 2", `: di %9.2f `SWF2'', ///
				"Kleibergen-Paap rk LM statistic", `: di %9.2f `e(idstat)'', ///
				"p-value", "[`: di %9.2f `e(idp)'']", "District education level", High, ///
				"Mean of DV", `: di %9.2f `meandv'', "# of provinces", ///
				`e(N_clust)', "District FE", YES, "Province-year FE", YES)
				
ivreg2			prop_mig_SE_o (per_immig_cst_5Y per_immig_cst_5Y_lag = ///
				pred_per_immig_cst_10Y_5Y pred_per_immig_cst_Jaeger_10Y) ///
				i.year#i.geolev1 i.geolev2 av_high_educ_ct prop_male_ct av_age_ct ///
				if high_educ_regency == 0, cl(geolev1) first	
mat				c = e(first)
local			SWF1= c[8,1]
local			SWF2= c[8,2]
su				`e(depvar)' if e(sample) == 1, d				
local			meandv=r(mean)
outreg2			using "Tables/Education heterogeneity 3.xlsx", excel tex append dec(4) ///
				keep(per_immig_cst_5Y per_immig_cst_5Y_lag) label nocons nonotes ///
				addtext("Sanderson-Windmeijer F-Stat 1", `: di %9.2f `SWF1'', ///
				"Sanderson-Windmeijer F-Stat 2", `: di %9.2f `SWF2'', ///
				"Kleibergen-Paap rk LM statistic", `: di %9.2f `e(idstat)'', ///
				"p-value", "[`: di %9.2f `e(idp)'']", "District education level", Low, ///
				"Mean of DV", `: di %9.2f `meandv'', "# of provinces", ///
				`e(N_clust)', "District FE", YES, "Province-year FE", YES)
				
ivreg2			prop_mig_SE_n (per_immig_cst_5Y per_immig_cst_5Y_lag = ///
				pred_per_immig_cst_10Y_5Y pred_per_immig_cst_Jaeger_10Y) ///
				i.year#i.geolev1 i.geolev2 av_high_educ_ct prop_male_ct av_age_ct ///
				if high_educ_regency == 1, cl(geolev1) first	
mat				c = e(first)
local			SWF1= c[8,1]
local			SWF2= c[8,2]
su				`e(depvar)' if e(sample) == 1, d				
local			meandv=r(mean)
outreg2			using "Tables/Education heterogeneity 3.xlsx", excel tex append dec(4) ///
				keep(per_immig_cst_5Y per_immig_cst_5Y_lag) label nocons nonotes ///
				addtext("Sanderson-Windmeijer F-Stat 1", `: di %9.2f `SWF1'', ///
				"Sanderson-Windmeijer F-Stat 2", `: di %9.2f `SWF2'', ///
				"Kleibergen-Paap rk LM statistic", `: di %9.2f `e(idstat)'', ///
				"p-value", "[`: di %9.2f `e(idp)'']", "District education level", High, ///
				"Mean of DV", `: di %9.2f `meandv'', "# of provinces", ///
				`e(N_clust)', "District FE", YES, "Province-year FE", YES)
				
ivreg2			prop_mig_SE_n (per_immig_cst_5Y per_immig_cst_5Y_lag = ///
				pred_per_immig_cst_10Y_5Y pred_per_immig_cst_Jaeger_10Y) ///
				i.year#i.geolev1 i.geolev2 av_high_educ_ct prop_male_ct av_age_ct ///
				if high_educ_regency == 0, cl(geolev1) first	
mat				c = e(first)
local			SWF1= c[8,1]
local			SWF2= c[8,2]
su				`e(depvar)' if e(sample) == 1, d				
local			meandv=r(mean)
outreg2			using "Tables/Education heterogeneity 3.xlsx", excel tex append dec(4) ///
				keep(per_immig_cst_5Y per_immig_cst_5Y_lag) label nocons nonotes ///
				addtext("Sanderson-Windmeijer F-Stat 1", `: di %9.2f `SWF1'', ///
				"Sanderson-Windmeijer F-Stat 2", `: di %9.2f `SWF2'', ///
				"Kleibergen-Paap rk LM statistic", `: di %9.2f `e(idstat)'', ///
				"p-value", "[`: di %9.2f `e(idp)'']", "District education level", Low, ///
				"Mean of DV", `: di %9.2f `meandv'', "# of provinces", ///
				`e(N_clust)', "District FE", YES, "Province-year FE", YES)						
				
				
		
/*******************************************************************************
					Unpaid employment
********************************************************************************/				
ivreg2			prop_unpaid (per_immig_cst_5Y per_immig_cst_5Y_lag = ///
				pred_per_immig_cst_10Y_5Y pred_per_immig_cst_Jaeger_10Y) ///
				i.year#i.geolev1 i.geolev2 av_high_educ_ct prop_male_ct av_age_ct ///
				if high_educ_regency == 1, cl(geolev1) first	
mat				c = e(first)
local			SWF1= c[8,1]
local			SWF2= c[8,2]
su				`e(depvar)' if e(sample) == 1, d				
local			meandv=r(mean)
outreg2			using "Tables/Education heterogeneity 4.xlsx", excel tex replace dec(4) ///
				keep(per_immig_cst_5Y per_immig_cst_5Y_lag) label nocons nonotes ///
				addtext("Sanderson-Windmeijer F-Stat 1", `: di %9.2f `SWF1'', ///
				"Sanderson-Windmeijer F-Stat 2", `: di %9.2f `SWF2'', ///
				"Kleibergen-Paap rk LM statistic", `: di %9.2f `e(idstat)'', ///
				"p-value", "[`: di %9.2f `e(idp)'']", "District education level", High, ///
				"Mean of DV", `: di %9.2f `meandv'', "# of provinces", ///
				`e(N_clust)', "District FE", YES, "Province-year FE", YES)

ivreg2			prop_unpaid (per_immig_cst_5Y per_immig_cst_5Y_lag = ///
				pred_per_immig_cst_10Y_5Y pred_per_immig_cst_Jaeger_10Y) ///
				i.year#i.geolev1 i.geolev2 av_high_educ_ct prop_male_ct av_age_ct ///
				if high_educ_regency == 0, cl(geolev1) first	
mat				c = e(first)
local			SWF1= c[8,1]
local			SWF2= c[8,2]
su				`e(depvar)' if e(sample) == 1, d				
local			meandv=r(mean)
outreg2			using "Tables/Education heterogeneity 4.xlsx", excel tex append dec(4) ///
				keep(per_immig_cst_5Y per_immig_cst_5Y_lag) label nocons nonotes ///
				addtext("Sanderson-Windmeijer F-Stat 1", `: di %9.2f `SWF1'', ///
				"Sanderson-Windmeijer F-Stat 2", `: di %9.2f `SWF2'', ///
				"Kleibergen-Paap rk LM statistic", `: di %9.2f `e(idstat)'', ///
				"p-value", "[`: di %9.2f `e(idp)'']", "District education level", Low, ///
				"Mean of DV", `: di %9.2f `meandv'', "# of provinces", ///
				`e(N_clust)', "District FE", YES, "Province-year FE", YES)
				
				
ivreg2			prop_native_unpaid (per_immig_cst_5Y per_immig_cst_5Y_lag = ///
				pred_per_immig_cst_10Y_5Y pred_per_immig_cst_Jaeger_10Y) ///
				i.year#i.geolev1 i.geolev2 av_high_educ_ct prop_male_ct av_age_ct ///
				if high_educ_regency == 1, cl(geolev1) first	
mat				c = e(first)
local			SWF1= c[8,1]
local			SWF2= c[8,2]
su				`e(depvar)' if e(sample) == 1, d				
local			meandv=r(mean)
outreg2			using "Tables/Education heterogeneity 4.xlsx", excel tex append dec(4) ///
				keep(per_immig_cst_5Y per_immig_cst_5Y_lag) label nocons nonotes ///
				addtext("Sanderson-Windmeijer F-Stat 1", `: di %9.2f `SWF1'', ///
				"Sanderson-Windmeijer F-Stat 2", `: di %9.2f `SWF2'', ///
				"Kleibergen-Paap rk LM statistic", `: di %9.2f `e(idstat)'', ///
				"p-value", "[`: di %9.2f `e(idp)'']", "District education level", High, ///
				"Mean of DV", `: di %9.2f `meandv'', "# of provinces", ///
				`e(N_clust)', "District FE", YES, "Province-year FE", YES)

ivreg2			prop_native_unpaid (per_immig_cst_5Y per_immig_cst_5Y_lag = ///
				pred_per_immig_cst_10Y_5Y pred_per_immig_cst_Jaeger_10Y) ///
				i.year#i.geolev1 i.geolev2 av_high_educ_ct prop_male_ct av_age_ct ///
				if high_educ_regency == 0, cl(geolev1) first	
mat				c = e(first)
local			SWF1= c[8,1]
local			SWF2= c[8,2]
su				`e(depvar)' if e(sample) == 1, d				
local			meandv=r(mean)
outreg2			using "Tables/Education heterogeneity 4.xlsx", excel tex append dec(4) ///
				keep(per_immig_cst_5Y per_immig_cst_5Y_lag) label nocons nonotes ///
				addtext("Sanderson-Windmeijer F-Stat 1", `: di %9.2f `SWF1'', ///
				"Sanderson-Windmeijer F-Stat 2", `: di %9.2f `SWF2'', ///
				"Kleibergen-Paap rk LM statistic", `: di %9.2f `e(idstat)'', ///
				"p-value", "[`: di %9.2f `e(idp)'']", "District education level", Low, ///
				"Mean of DV", `: di %9.2f `meandv'', "# of provinces", ///
				`e(N_clust)', "District FE", YES, "Province-year FE", YES)
				
				
ivreg2			prop_mig_unpaid_o (per_immig_cst_5Y per_immig_cst_5Y_lag = ///
				pred_per_immig_cst_10Y_5Y pred_per_immig_cst_Jaeger_10Y) ///
				i.year#i.geolev1 i.geolev2 av_high_educ_ct prop_male_ct av_age_ct ///
				if high_educ_regency == 1, cl(geolev1) first	
mat				c = e(first)
local			SWF1= c[8,1]
local			SWF2= c[8,2]
su				`e(depvar)' if e(sample) == 1, d				
local			meandv=r(mean)
outreg2			using "Tables/Education heterogeneity 4.xlsx", excel tex append dec(4) ///
				keep(per_immig_cst_5Y per_immig_cst_5Y_lag) label nocons nonotes ///
				addtext("Sanderson-Windmeijer F-Stat 1", `: di %9.2f `SWF1'', ///
				"Sanderson-Windmeijer F-Stat 2", `: di %9.2f `SWF2'', ///
				"Kleibergen-Paap rk LM statistic", `: di %9.2f `e(idstat)'', ///
				"p-value", "[`: di %9.2f `e(idp)'']", "District education level", High, ///
				"Mean of DV", `: di %9.2f `meandv'', "# of provinces", ///
				`e(N_clust)', "District FE", YES, "Province-year FE", YES)
				
ivreg2			prop_mig_unpaid_o (per_immig_cst_5Y per_immig_cst_5Y_lag = ///
				pred_per_immig_cst_10Y_5Y pred_per_immig_cst_Jaeger_10Y) ///
				i.year#i.geolev1 i.geolev2 av_high_educ_ct prop_male_ct av_age_ct ///
				if high_educ_regency == 0, cl(geolev1) first	
mat				c = e(first)
local			SWF1= c[8,1]
local			SWF2= c[8,2]
su				`e(depvar)' if e(sample) == 1, d				
local			meandv=r(mean)
outreg2			using "Tables/Education heterogeneity 4.xlsx", excel tex append dec(4) ///
				keep(per_immig_cst_5Y per_immig_cst_5Y_lag) label nocons nonotes ///
				addtext("Sanderson-Windmeijer F-Stat 1", `: di %9.2f `SWF1'', ///
				"Sanderson-Windmeijer F-Stat 2", `: di %9.2f `SWF2'', ///
				"Kleibergen-Paap rk LM statistic", `: di %9.2f `e(idstat)'', ///
				"p-value", "[`: di %9.2f `e(idp)'']", "District education level", Low, ///
				"Mean of DV", `: di %9.2f `meandv'', "# of provinces", ///
				`e(N_clust)', "District FE", YES, "Province-year FE", YES)
				
ivreg2			prop_mig_unpaid_n (per_immig_cst_5Y per_immig_cst_5Y_lag = ///
				pred_per_immig_cst_10Y_5Y pred_per_immig_cst_Jaeger_10Y) ///
				i.year#i.geolev1 i.geolev2 av_high_educ_ct prop_male_ct av_age_ct ///
				if high_educ_regency == 1, cl(geolev1) first	
mat				c = e(first)
local			SWF1= c[8,1]
local			SWF2= c[8,2]
su				`e(depvar)' if e(sample) == 1, d				
local			meandv=r(mean)
outreg2			using "Tables/Education heterogeneity 4.xlsx", excel tex append dec(4) ///
				keep(per_immig_cst_5Y per_immig_cst_5Y_lag) label nocons nonotes ///
				addtext("Sanderson-Windmeijer F-Stat 1", `: di %9.2f `SWF1'', ///
				"Sanderson-Windmeijer F-Stat 2", `: di %9.2f `SWF2'', ///
				"Kleibergen-Paap rk LM statistic", `: di %9.2f `e(idstat)'', ///
				"p-value", "[`: di %9.2f `e(idp)'']", "District education level", High, ///
				"Mean of DV", `: di %9.2f `meandv'', "# of provinces", ///
				`e(N_clust)', "District FE", YES, "Province-year FE", YES)
				
ivreg2			prop_mig_unpaid_n (per_immig_cst_5Y per_immig_cst_5Y_lag = ///
				pred_per_immig_cst_10Y_5Y pred_per_immig_cst_Jaeger_10Y) ///
				i.year#i.geolev1 i.geolev2 av_high_educ_ct prop_male_ct av_age_ct ///
				if high_educ_regency == 0, cl(geolev1) first	
mat				c = e(first)
local			SWF1= c[8,1]
local			SWF2= c[8,2]
su				`e(depvar)' if e(sample) == 1, d				
local			meandv=r(mean)
outreg2			using "Tables/Education heterogeneity 4.xlsx", excel tex append dec(4) ///
				keep(per_immig_cst_5Y per_immig_cst_5Y_lag) label nocons nonotes ///
				addtext("Sanderson-Windmeijer F-Stat 1", `: di %9.2f `SWF1'', ///
				"Sanderson-Windmeijer F-Stat 2", `: di %9.2f `SWF2'', ///
				"Kleibergen-Paap rk LM statistic", `: di %9.2f `e(idstat)'', ///
				"p-value", "[`: di %9.2f `e(idp)'']", "District education level", Low, ///
				"Mean of DV", `: di %9.2f `meandv'', "# of provinces", ///
				`e(N_clust)', "District FE", YES, "Province-year FE", YES)						
				


********************************************************************************
********************************************************************************
********************************************************************************
********************************************************************************
********************************************************************************
********************************************************************************
********************************************************************************
********************************************************************************
************************* EDUCATION HETEROGENEITY ******************************
********************************************************************************
set				matsize 11000	
use				"Data/Merged", clear
foreach 		var in ed_1_emp_native ed_2_emp_native ed_3_emp_native ed_4_emp_native ///
				ed_1_wage_native ed_2_wage_native ed_3_wage_native ed_4_wage_native ///
				ed_1_SE_native ed_2_SE_native ed_3_SE_native ed_4_SE_native ///
				ed_1_unpaid_native ed_2_unpaid_native ed_3_unpaid_native ed_4_unpaid_native{
replace			prop_`var' = prop_`var' * 100
}
label 			var per_immig_cst_5Y "Population share of new migrants in year t"
label 			var per_immig_cst_5Y_lag "Population share of new migrants in year t-5"

************************** EMPLOYMENT ****************************************
ivreg2			prop_ed_1_emp_native (per_immig_cst_5Y per_immig_cst_5Y_lag = ///
				pred_per_immig_cst_10Y_5Y pred_per_immig_cst_Jaeger_10Y) ///
				i.year#i.geolev1 i.geolev2 av_high_educ_ct prop_male_ct av_age_ct, ///
				cl(geolev1) first	
mat				c = e(first)
local			SWF1= c[8,1]
local			SWF2= c[8,2]
su				`e(depvar)' if e(sample) == 1, d				
local			meandv=r(mean)
outreg2			using "Tables/Education level 0.xlsx", excel tex replace dec(4) ///
				keep(per_immig_cst_5Y per_immig_cst_5Y_lag) label nocons nonotes ///
				addtext("Sanderson-Windmeijer F-Stat 1", `: di %9.2f `SWF1'', ///
				"Sanderson-Windmeijer F-Stat 2", `: di %9.2f `SWF2'', ///
				"Kleibergen-Paap rk LM statistic", `: di %9.2f `e(idstat)'', ///
				"p-value", "[`: di %9.2f `e(idp)'']", "Native education level", < primary, ///
				"Mean of DV", `: di %9.2f `meandv'', "# of provinces", ///
				`e(N_clust)', "District FE", YES, "Province-year FE", YES)		
							
ivreg2			prop_ed_2_emp_native (per_immig_cst_5Y per_immig_cst_5Y_lag = ///
				pred_per_immig_cst_10Y_5Y pred_per_immig_cst_Jaeger_10Y) ///
				i.year#i.geolev1 i.geolev2 av_high_educ_ct prop_male_ct av_age_ct, ///
				cl(geolev1) first	
mat				c = e(first)
local			SWF1= c[8,1]
local			SWF2= c[8,2]
su				`e(depvar)' if e(sample) == 1, d				
local			meandv=r(mean)
outreg2			using "Tables/Education level 0.xlsx", excel tex append dec(4) ///
				keep(per_immig_cst_5Y per_immig_cst_5Y_lag) label nocons nonotes ///
				addtext("Sanderson-Windmeijer F-Stat 1", `: di %9.2f `SWF1'', ///
				"Sanderson-Windmeijer F-Stat 2", `: di %9.2f `SWF2'', ///
				"Kleibergen-Paap rk LM statistic", `: di %9.2f `e(idstat)'', ///
				"p-value", "[`: di %9.2f `e(idp)'']", "Native education level", completed primary, ///
				"Mean of DV", `: di %9.2f `meandv'', "# of provinces", ///
				`e(N_clust)', "District FE", YES, "Province-year FE", YES)	
				
ivreg2			prop_ed_3_emp_native (per_immig_cst_5Y per_immig_cst_5Y_lag = ///
				pred_per_immig_cst_10Y_5Y pred_per_immig_cst_Jaeger_10Y) ///
				i.year#i.geolev1 i.geolev2 av_high_educ_ct prop_male_ct av_age_ct, ///
				cl(geolev1) first	
mat				c = e(first)
local			SWF1= c[8,1]
local			SWF2= c[8,2]
su				`e(depvar)' if e(sample) == 1, d				
local			meandv=r(mean)
outreg2			using "Tables/Education level 0.xlsx", excel tex append dec(4) ///
				keep(per_immig_cst_5Y per_immig_cst_5Y_lag) label nocons nonotes ///
				addtext("Sanderson-Windmeijer F-Stat 1", `: di %9.2f `SWF1'', ///
				"Sanderson-Windmeijer F-Stat 2", `: di %9.2f `SWF2'', ///
				"Kleibergen-Paap rk LM statistic", `: di %9.2f `e(idstat)'', ///
				"p-value", "[`: di %9.2f `e(idp)'']", "Native education level", completed secondary, ///
				"Mean of DV", `: di %9.2f `meandv'', "# of provinces", ///
				`e(N_clust)', "District FE", YES, "Province-year FE", YES)
						
ivreg2			prop_ed_4_emp_native (per_immig_cst_5Y per_immig_cst_5Y_lag = ///
				pred_per_immig_cst_10Y_5Y pred_per_immig_cst_Jaeger_10Y) ///
				i.year#i.geolev1 i.geolev2 av_high_educ_ct prop_male_ct av_age_ct, ///
				cl(geolev1) first	
mat				c = e(first)
local			SWF1= c[8,1]
local			SWF2= c[8,2]
su				`e(depvar)' if e(sample) == 1, d				
local			meandv=r(mean)
outreg2			using "Tables/Education level 0.xlsx", excel tex append dec(4) ///
				keep(per_immig_cst_5Y per_immig_cst_5Y_lag) label nocons nonotes ///
				addtext("Sanderson-Windmeijer F-Stat 1", `: di %9.2f `SWF1'', ///
				"Sanderson-Windmeijer F-Stat 2", `: di %9.2f `SWF2'', ///
				"Kleibergen-Paap rk LM statistic", `: di %9.2f `e(idstat)'', ///
				"p-value", "[`: di %9.2f `e(idp)'']", "Native education level", completed tertiary, ///
				"Mean of DV", `: di %9.2f `meandv'', "# of provinces", ///
				`e(N_clust)', "District FE", YES, "Province-year FE", YES)
				

				
				
************************** WAGE NATIVES ****************************************
ivreg2			prop_ed_1_wage_native (per_immig_cst_5Y per_immig_cst_5Y_lag = ///
				pred_per_immig_cst_10Y_5Y pred_per_immig_cst_Jaeger_10Y) ///
				i.year#i.geolev1 i.geolev2 av_high_educ_ct prop_male_ct av_age_ct, ///
				cl(geolev1) first	
mat				c = e(first)
local			SWF1= c[8,1]
local			SWF2= c[8,2]
su				`e(depvar)' if e(sample) == 1, d				
local			meandv=r(mean)
outreg2			using "Tables/Education level 1.xlsx", excel tex replace dec(4) ///
				keep(per_immig_cst_5Y per_immig_cst_5Y_lag) label nocons nonotes ///
				addtext("Sanderson-Windmeijer F-Stat 1", `: di %9.2f `SWF1'', ///
				"Sanderson-Windmeijer F-Stat 2", `: di %9.2f `SWF2'', ///
				"Kleibergen-Paap rk LM statistic", `: di %9.2f `e(idstat)'', ///
				"p-value", "[`: di %9.2f `e(idp)'']", "Native education level", < primary, ///
				"Mean of DV", `: di %9.2f `meandv'', "# of provinces", ///
				`e(N_clust)', "District FE", YES, "Province-year FE", YES)		
							
ivreg2			prop_ed_2_wage_native (per_immig_cst_5Y per_immig_cst_5Y_lag = ///
				pred_per_immig_cst_10Y_5Y pred_per_immig_cst_Jaeger_10Y) ///
				i.year#i.geolev1 i.geolev2 av_high_educ_ct prop_male_ct av_age_ct, ///
				cl(geolev1) first	
mat				c = e(first)
local			SWF1= c[8,1]
local			SWF2= c[8,2]
su				`e(depvar)' if e(sample) == 1, d				
local			meandv=r(mean)
outreg2			using "Tables/Education level 1.xlsx", excel tex append dec(4) ///
				keep(per_immig_cst_5Y per_immig_cst_5Y_lag) label nocons nonotes ///
				addtext("Sanderson-Windmeijer F-Stat 1", `: di %9.2f `SWF1'', ///
				"Sanderson-Windmeijer F-Stat 2", `: di %9.2f `SWF2'', ///
				"Kleibergen-Paap rk LM statistic", `: di %9.2f `e(idstat)'', ///
				"p-value", "[`: di %9.2f `e(idp)'']", "Native education level", completed primary, ///
				"Mean of DV", `: di %9.2f `meandv'', "# of provinces", ///
				`e(N_clust)', "District FE", YES, "Province-year FE", YES)	
				
ivreg2			prop_ed_3_wage_native (per_immig_cst_5Y per_immig_cst_5Y_lag = ///
				pred_per_immig_cst_10Y_5Y pred_per_immig_cst_Jaeger_10Y) ///
				i.year#i.geolev1 i.geolev2 av_high_educ_ct prop_male_ct av_age_ct, ///
				cl(geolev1) first	
mat				c = e(first)
local			SWF1= c[8,1]
local			SWF2= c[8,2]
su				`e(depvar)' if e(sample) == 1, d				
local			meandv=r(mean)
outreg2			using "Tables/Education level 1.xlsx", excel tex append dec(4) ///
				keep(per_immig_cst_5Y per_immig_cst_5Y_lag) label nocons nonotes ///
				addtext("Sanderson-Windmeijer F-Stat 1", `: di %9.2f `SWF1'', ///
				"Sanderson-Windmeijer F-Stat 2", `: di %9.2f `SWF2'', ///
				"Kleibergen-Paap rk LM statistic", `: di %9.2f `e(idstat)'', ///
				"p-value", "[`: di %9.2f `e(idp)'']", "Native education level", completed secondary, ///
				"Mean of DV", `: di %9.2f `meandv'', "# of provinces", ///
				`e(N_clust)', "District FE", YES, "Province-year FE", YES)
						
ivreg2			prop_ed_4_wage_native (per_immig_cst_5Y per_immig_cst_5Y_lag = ///
				pred_per_immig_cst_10Y_5Y pred_per_immig_cst_Jaeger_10Y) ///
				i.year#i.geolev1 i.geolev2 av_high_educ_ct prop_male_ct av_age_ct, ///
				cl(geolev1) first	
mat				c = e(first)
local			SWF1= c[8,1]
local			SWF2= c[8,2]
su				`e(depvar)' if e(sample) == 1, d				
local			meandv=r(mean)
outreg2			using "Tables/Education level 1.xlsx", excel tex append dec(4) ///
				keep(per_immig_cst_5Y per_immig_cst_5Y_lag) label nocons nonotes ///
				addtext("Sanderson-Windmeijer F-Stat 1", `: di %9.2f `SWF1'', ///
				"Sanderson-Windmeijer F-Stat 2", `: di %9.2f `SWF2'', ///
				"Kleibergen-Paap rk LM statistic", `: di %9.2f `e(idstat)'', ///
				"p-value", "[`: di %9.2f `e(idp)'']", "Native education level", completed tertiary, ///
				"Mean of DV", `: di %9.2f `meandv'', "# of provinces", ///
				`e(N_clust)', "District FE", YES, "Province-year FE", YES)
				
				
************************** SE NATIVES ****************************************
ivreg2			prop_ed_1_SE_native (per_immig_cst_5Y per_immig_cst_5Y_lag = ///
				pred_per_immig_cst_10Y_5Y pred_per_immig_cst_Jaeger_10Y) ///
				i.year#i.geolev1 i.geolev2 av_high_educ_ct prop_male_ct av_age_ct, ///
				cl(geolev1) first	
mat				c = e(first)
local			SWF1= c[8,1]
local			SWF2= c[8,2]
su				`e(depvar)' if e(sample) == 1, d				
local			meandv=r(mean)
outreg2			using "Tables/Education level 2.xlsx", excel tex replace dec(4) ///
				keep(per_immig_cst_5Y per_immig_cst_5Y_lag) label nocons nonotes ///
				addtext("Sanderson-Windmeijer F-Stat 1", `: di %9.2f `SWF1'', ///
				"Sanderson-Windmeijer F-Stat 2", `: di %9.2f `SWF2'', ///
				"Kleibergen-Paap rk LM statistic", `: di %9.2f `e(idstat)'', ///
				"p-value", "[`: di %9.2f `e(idp)'']", "Native education level", < primary, ///
				"Mean of DV", `: di %9.2f `meandv'', "# of provinces", ///
				`e(N_clust)', "District FE", YES, "Province-year FE", YES)		
							
ivreg2			prop_ed_2_SE_native (per_immig_cst_5Y per_immig_cst_5Y_lag = ///
				pred_per_immig_cst_10Y_5Y pred_per_immig_cst_Jaeger_10Y) ///
				i.year#i.geolev1 i.geolev2 av_high_educ_ct prop_male_ct av_age_ct, ///
				cl(geolev1) first	
mat				c = e(first)
local			SWF1= c[8,1]
local			SWF2= c[8,2]
su				`e(depvar)' if e(sample) == 1, d				
local			meandv=r(mean)
outreg2			using "Tables/Education level 2.xlsx", excel tex append dec(4) ///
				keep(per_immig_cst_5Y per_immig_cst_5Y_lag) label nocons nonotes ///
				addtext("Sanderson-Windmeijer F-Stat 1", `: di %9.2f `SWF1'', ///
				"Sanderson-Windmeijer F-Stat 2", `: di %9.2f `SWF2'', ///
				"Kleibergen-Paap rk LM statistic", `: di %9.2f `e(idstat)'', ///
				"p-value", "[`: di %9.2f `e(idp)'']", "Native education level", completed primary, ///
				"Mean of DV", `: di %9.2f `meandv'', "# of provinces", ///
				`e(N_clust)', "District FE", YES, "Province-year FE", YES)	
				
ivreg2			prop_ed_3_SE_native (per_immig_cst_5Y per_immig_cst_5Y_lag = ///
				pred_per_immig_cst_10Y_5Y pred_per_immig_cst_Jaeger_10Y) ///
				i.year#i.geolev1 i.geolev2 av_high_educ_ct prop_male_ct av_age_ct, ///
				cl(geolev1) first	
mat				c = e(first)
local			SWF1= c[8,1]
local			SWF2= c[8,2]
su				`e(depvar)' if e(sample) == 1, d				
local			meandv=r(mean)
outreg2			using "Tables/Education level 2.xlsx", excel tex append dec(4) ///
				keep(per_immig_cst_5Y per_immig_cst_5Y_lag) label nocons nonotes ///
				addtext("Sanderson-Windmeijer F-Stat 1", `: di %9.2f `SWF1'', ///
				"Sanderson-Windmeijer F-Stat 2", `: di %9.2f `SWF2'', ///
				"Kleibergen-Paap rk LM statistic", `: di %9.2f `e(idstat)'', ///
				"p-value", "[`: di %9.2f `e(idp)'']", "Native education level", completed secondary, ///
				"Mean of DV", `: di %9.2f `meandv'', "# of provinces", ///
				`e(N_clust)', "District FE", YES, "Province-year FE", YES)
						
ivreg2			prop_ed_4_SE_native (per_immig_cst_5Y per_immig_cst_5Y_lag = ///
				pred_per_immig_cst_10Y_5Y pred_per_immig_cst_Jaeger_10Y) ///
				i.year#i.geolev1 i.geolev2 av_high_educ_ct prop_male_ct av_age_ct, ///
				cl(geolev1) first	
mat				c = e(first)
local			SWF1= c[8,1]
local			SWF2= c[8,2]
su				`e(depvar)' if e(sample) == 1, d				
local			meandv=r(mean)
outreg2			using "Tables/Education level 2.xlsx", excel tex append dec(4) ///
				keep(per_immig_cst_5Y per_immig_cst_5Y_lag) label nocons nonotes ///
				addtext("Sanderson-Windmeijer F-Stat 1", `: di %9.2f `SWF1'', ///
				"Sanderson-Windmeijer F-Stat 2", `: di %9.2f `SWF2'', ///
				"Kleibergen-Paap rk LM statistic", `: di %9.2f `e(idstat)'', ///
				"p-value", "[`: di %9.2f `e(idp)'']", "Native education level", completed tertiary, ///
				"Mean of DV", `: di %9.2f `meandv'', "# of provinces", ///
				`e(N_clust)', "District FE", YES, "Province-year FE", YES)
				
				
************************** SE NATIVES ****************************************
ivreg2			prop_ed_1_unpaid_native (per_immig_cst_5Y per_immig_cst_5Y_lag = ///
				pred_per_immig_cst_10Y_5Y pred_per_immig_cst_Jaeger_10Y) ///
				i.year#i.geolev1 i.geolev2 av_high_educ_ct prop_male_ct av_age_ct, ///
				cl(geolev1) first	
mat				c = e(first)
local			SWF1= c[8,1]
local			SWF2= c[8,2]
su				`e(depvar)' if e(sample) == 1, d				
local			meandv=r(mean)
outreg2			using "Tables/Education level 3.xlsx", excel tex replace dec(4) ///
				keep(per_immig_cst_5Y per_immig_cst_5Y_lag) label nocons nonotes ///
				addtext("Sanderson-Windmeijer F-Stat 1", `: di %9.2f `SWF1'', ///
				"Sanderson-Windmeijer F-Stat 2", `: di %9.2f `SWF2'', ///
				"Kleibergen-Paap rk LM statistic", `: di %9.2f `e(idstat)'', ///
				"p-value", "[`: di %9.2f `e(idp)'']", "Native education level", < primary, ///
				"Mean of DV", `: di %9.2f `meandv'', "# of provinces", ///
				`e(N_clust)', "District FE", YES, "Province-year FE", YES)		
							
ivreg2			prop_ed_2_unpaid_native (per_immig_cst_5Y per_immig_cst_5Y_lag = ///
				pred_per_immig_cst_10Y_5Y pred_per_immig_cst_Jaeger_10Y) ///
				i.year#i.geolev1 i.geolev2 av_high_educ_ct prop_male_ct av_age_ct, ///
				cl(geolev1) first	
mat				c = e(first)
local			SWF1= c[8,1]
local			SWF2= c[8,2]
su				`e(depvar)' if e(sample) == 1, d				
local			meandv=r(mean)
outreg2			using "Tables/Education level 3.xlsx", excel tex append dec(4) ///
				keep(per_immig_cst_5Y per_immig_cst_5Y_lag) label nocons nonotes ///
				addtext("Sanderson-Windmeijer F-Stat 1", `: di %9.2f `SWF1'', ///
				"Sanderson-Windmeijer F-Stat 2", `: di %9.2f `SWF2'', ///
				"Kleibergen-Paap rk LM statistic", `: di %9.2f `e(idstat)'', ///
				"p-value", "[`: di %9.2f `e(idp)'']", "Native education level", completed primary, ///
				"Mean of DV", `: di %9.2f `meandv'', "# of provinces", ///
				`e(N_clust)', "District FE", YES, "Province-year FE", YES)	
				
ivreg2			prop_ed_3_unpaid_native (per_immig_cst_5Y per_immig_cst_5Y_lag = ///
				pred_per_immig_cst_10Y_5Y pred_per_immig_cst_Jaeger_10Y) ///
				i.year#i.geolev1 i.geolev2 av_high_educ_ct prop_male_ct av_age_ct, ///
				cl(geolev1) first	
mat				c = e(first)
local			SWF1= c[8,1]
local			SWF2= c[8,2]
su				`e(depvar)' if e(sample) == 1, d				
local			meandv=r(mean)
outreg2			using "Tables/Education level 3.xlsx", excel tex append dec(4) ///
				keep(per_immig_cst_5Y per_immig_cst_5Y_lag) label nocons nonotes ///
				addtext("Sanderson-Windmeijer F-Stat 1", `: di %9.2f `SWF1'', ///
				"Sanderson-Windmeijer F-Stat 2", `: di %9.2f `SWF2'', ///
				"Kleibergen-Paap rk LM statistic", `: di %9.2f `e(idstat)'', ///
				"p-value", "[`: di %9.2f `e(idp)'']", "Native education level", completed secondary, ///
				"Mean of DV", `: di %9.2f `meandv'', "# of provinces", ///
				`e(N_clust)', "District FE", YES, "Province-year FE", YES)
						
ivreg2			prop_ed_4_unpaid_native (per_immig_cst_5Y per_immig_cst_5Y_lag = ///
				pred_per_immig_cst_10Y_5Y pred_per_immig_cst_Jaeger_10Y) ///
				i.year#i.geolev1 i.geolev2 av_high_educ_ct prop_male_ct av_age_ct, ///
				cl(geolev1) first	
mat				c = e(first)
local			SWF1= c[8,1]
local			SWF2= c[8,2]
su				`e(depvar)' if e(sample) == 1, d				
local			meandv=r(mean)
outreg2			using "Tables/Education level 3.xlsx", excel tex append dec(4) ///
				keep(per_immig_cst_5Y per_immig_cst_5Y_lag) label nocons nonotes ///
				addtext("Sanderson-Windmeijer F-Stat 1", `: di %9.2f `SWF1'', ///
				"Sanderson-Windmeijer F-Stat 2", `: di %9.2f `SWF2'', ///
				"Kleibergen-Paap rk LM statistic", `: di %9.2f `e(idstat)'', ///
				"p-value", "[`: di %9.2f `e(idp)'']", "Native education level", completed tertiary, ///
				"Mean of DV", `: di %9.2f `meandv'', "# of provinces", ///
				`e(N_clust)', "District FE", YES, "Province-year FE", YES)
